<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Kyoto Cabinet: kyotocabinet::TaskQueue Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Kyoto Cabinet
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespacekyotocabinet.html">kyotocabinet</a>      </li>
      <li class="navelem"><a class="el" href="classkyotocabinet_1_1TaskQueue.html">TaskQueue</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">kyotocabinet::TaskQueue Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="kyotocabinet::TaskQueue" -->
<p><a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html" title="Interface of a task.">Task</a> queue device.  
 <a href="classkyotocabinet_1_1TaskQueue.html#details">More...</a></p>

<p><code>#include &lt;kcthread.h&gt;</code></p>

<p><a href="classkyotocabinet_1_1TaskQueue-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Interface of a task.  <a href="classkyotocabinet_1_1TaskQueue_1_1Task.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>WorkerThread</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Implementation of the worker thread. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#ae3b37efa706a67c4db3ffd4b793bf718">TaskQueue</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Default Constructor.  <a href="#ae3b37efa706a67c4db3ffd4b793bf718"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#ae6d285ecd15e0a231903ffb8d09fd9d4">~TaskQueue</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#ae6d285ecd15e0a231903ffb8d09fd9d4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#ac554ce85e6ca0a0ef834df5eb53b52a5">do_task</a> (<a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *task)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Process a task.  <a href="#ac554ce85e6ca0a0ef834df5eb53b52a5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#a37cd596df05339ca34b7b021baa3966f">do_start</a> (const <a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *task)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Process the starting event.  <a href="#a37cd596df05339ca34b7b021baa3966f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#a67bfe18de72e04a27306f74e38a69503">do_finish</a> (const <a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *task)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Process the finishing event.  <a href="#a67bfe18de72e04a27306f74e38a69503"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#af3230686464dcdf19cd0a1585957525e">start</a> (size_t thnum)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the task queue.  <a href="#af3230686464dcdf19cd0a1585957525e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#a1ff57b077f4907b5015daf94c8325abe">finish</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Finish the task queue.  <a href="#a1ff57b077f4907b5015daf94c8325abe"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#a54b41ea6da44344eec8132fb71df6b91">add_task</a> (<a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *task)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a task.  <a href="#a54b41ea6da44344eec8132fb71df6b91"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#aeefc2ac15234d9be37b6459c9176dad9">count</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of tasks in the queue.  <a href="#aeefc2ac15234d9be37b6459c9176dad9"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html" title="Interface of a task.">Task</a> queue device. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae3b37efa706a67c4db3ffd4b793bf718"></a><!-- doxytag: member="kyotocabinet::TaskQueue::TaskQueue" ref="ae3b37efa706a67c4db3ffd4b793bf718" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classkyotocabinet_1_1TaskQueue.html#ae3b37efa706a67c4db3ffd4b793bf718">kyotocabinet::TaskQueue::TaskQueue</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Default Constructor. </p>

</div>
</div>
<a class="anchor" id="ae6d285ecd15e0a231903ffb8d09fd9d4"></a><!-- doxytag: member="kyotocabinet::TaskQueue::~TaskQueue" ref="ae6d285ecd15e0a231903ffb8d09fd9d4" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="classkyotocabinet_1_1TaskQueue.html#ae6d285ecd15e0a231903ffb8d09fd9d4">kyotocabinet::TaskQueue::~TaskQueue</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ac554ce85e6ca0a0ef834df5eb53b52a5"></a><!-- doxytag: member="kyotocabinet::TaskQueue::do_task" ref="ac554ce85e6ca0a0ef834df5eb53b52a5" args="(Task *task)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void <a class="el" href="classkyotocabinet_1_1TaskQueue.html#ac554ce85e6ca0a0ef834df5eb53b52a5">kyotocabinet::TaskQueue::do_task</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *&#160;</td>
          <td class="paramname"><em>task</em></td><td>)</td>
          <td><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Process a task. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>a task object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a37cd596df05339ca34b7b021baa3966f"></a><!-- doxytag: member="kyotocabinet::TaskQueue::do_start" ref="a37cd596df05339ca34b7b021baa3966f" args="(const Task *task)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void <a class="el" href="classkyotocabinet_1_1TaskQueue.html#a37cd596df05339ca34b7b021baa3966f">kyotocabinet::TaskQueue::do_start</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *&#160;</td>
          <td class="paramname"><em>task</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Process the starting event. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>a task object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This is called for each thread on starting. </dd></dl>

</div>
</div>
<a class="anchor" id="a67bfe18de72e04a27306f74e38a69503"></a><!-- doxytag: member="kyotocabinet::TaskQueue::do_finish" ref="a67bfe18de72e04a27306f74e38a69503" args="(const Task *task)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void <a class="el" href="classkyotocabinet_1_1TaskQueue.html#a67bfe18de72e04a27306f74e38a69503">kyotocabinet::TaskQueue::do_finish</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *&#160;</td>
          <td class="paramname"><em>task</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Process the finishing event. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>a task object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This is called for each thread on finishing. </dd></dl>

</div>
</div>
<a class="anchor" id="af3230686464dcdf19cd0a1585957525e"></a><!-- doxytag: member="kyotocabinet::TaskQueue::start" ref="af3230686464dcdf19cd0a1585957525e" args="(size_t thnum)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classkyotocabinet_1_1TaskQueue.html#af3230686464dcdf19cd0a1585957525e">kyotocabinet::TaskQueue::start</a> </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>thnum</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Start the task queue. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">thnum</td><td>the number of worker threads. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a1ff57b077f4907b5015daf94c8325abe"></a><!-- doxytag: member="kyotocabinet::TaskQueue::finish" ref="a1ff57b077f4907b5015daf94c8325abe" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classkyotocabinet_1_1TaskQueue.html#a1ff57b077f4907b5015daf94c8325abe">kyotocabinet::TaskQueue::finish</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Finish the task queue. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>This function blocks until all tasks in the queue are popped. </dd></dl>

</div>
</div>
<a class="anchor" id="a54b41ea6da44344eec8132fb71df6b91"></a><!-- doxytag: member="kyotocabinet::TaskQueue::add_task" ref="a54b41ea6da44344eec8132fb71df6b91" args="(Task *task)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t <a class="el" href="classkyotocabinet_1_1TaskQueue.html#a54b41ea6da44344eec8132fb71df6b91">kyotocabinet::TaskQueue::add_task</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classkyotocabinet_1_1TaskQueue_1_1Task.html">Task</a> *&#160;</td>
          <td class="paramname"><em>task</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Add a task. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>a task object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of tasks in the queue. </dd></dl>

</div>
</div>
<a class="anchor" id="aeefc2ac15234d9be37b6459c9176dad9"></a><!-- doxytag: member="kyotocabinet::TaskQueue::count" ref="aeefc2ac15234d9be37b6459c9176dad9" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t <a class="el" href="classkyotocabinet_1_1TaskQueue.html#aeefc2ac15234d9be37b6459c9176dad9">kyotocabinet::TaskQueue::count</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the number of tasks in the queue. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of tasks in the queue. </dd></dl>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri May 25 2012 01:21:36 for Kyoto Cabinet by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
